import 'dart:async';

import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class BannerView extends StatefulWidget {
  final List<InkWell> children;
  final Duration duration;

  BannerView(this.children, this.duration);

  @override
  State<BannerView> createState() => _BannerViewState();
}

class _BannerViewState extends State<BannerView> {

  @override
  Widget build(BuildContext context) {
    return CarouselSlider.builder(
        itemCount: widget.children.length,
        itemBuilder: (BuildContext context, int index , int real) {
            return widget.children[index];
        },
        options: CarouselOptions(
          enlargeCenterPage: true,
          autoPlay: true,
          autoPlayInterval: widget.duration,
          viewportFraction: 1,
          initialPage: 0,
          enableInfiniteScroll: true,
          reverse: false,
        )
    );
  }
}
